{include file='common/head'}
<style>
    form {
        background-color: #fff;
    }

    .layui-card {
        border: 1px solid #eee;
    }
</style>
<script>
    document.title = "卡密兑换 | {:config('system.base.title')} "
</script>
<div class="layout">
    <span class="layui-breadcrumb">
        <a href="{:url('/index/index/index')}">首页</a>
        <a><cite>卡密兑换</cite></a>
    </span>
    <form class="layui-form layui-padding-1" action="">
        <div class="layui-card">
            <div class="layui-card-header">使用须知</div>
            <div class="layui-card-body">
                Ps：每张卡密只能使用一次哦！<br>
                确保输入的是正确卡密
            </div>
        </div>
        <div class="layui-form-item layui-form-pane">
            <label class="layui-form-label">卡密</label>
            <div class="layui-input-block">
                <input type="text" name="fake" lay-verify="required" placeholder="请输入卡密" autocomplete="off"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-clear" style="margin-top: 10px;">
            <button type="submit" class="layui-btn layui-btn-sm layui-bg-orange" lay-submit lay-filter="submit"
                style="float: right;">立即提交</button>
        </div>

    </form>

</div>
</div>
{include file='common/bottom'}
<script>
    layui.use(function () {
        const form = layui.form
        $ = layui.$
        const layer = layui.layer
        form.on('submit(submit)', (data) => {
            let field = data.field
            $.post('/index/account/useFake', field, (res) => {
                if (res.code == 200) {
                    layer.msg(res.message, { icon: 6 })
                }else{
                    layer.msg(res.message, { icon: 5 })
                }
            })
            return false
        })
    })
</script>